{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">分销记录</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-add="{:$auth->check('member_bill/add')}"
                   data-auth-edit="{:$auth->check('member_bill/edit')}"
                   data-auth-delete="{:$auth->check('member_bill/del')}"
                   data-auth-recyclebin="{:$auth->check('member_bill/recyclebin')}"
            ></table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var member_id = <?php echo $member_id; ?>

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: '{:url("add")}',
            edit_url: '{:url("edit")}',
            delete_url: '{:url("del")}',
            modify_url: "{:url('multi')}",
            recyclebin_url: "{:url('recyclebin')}",
        };
        table.render({
            init: init,
            toolbar: ['refresh'],
            url: '{:url("index")}?member_id=' + member_id,
            cols: [
                [
                    {field: 'id', title: 'id', align: 'center', minWidth: 80,search: false},
                    {
                        field: 'type',
                        title: '类型',
                        minWidth: 120,
                        align: 'center',
                        templet: yznTable.formatter.label,
                        selectList: {1:'团队分销',2:'财税顾问分销'},

                    },

                    {field: 'member.nickname', title: '被推荐人', align: 'center', minWidth: 140},
                    {
                        field: 'income_type',
                        title: '收入类型 ',
                        minWidth: 110,
                        align: 'center',
                        templet: yznTable.formatter.status,
                        selectList: {'goods': '商品', 'vip': 'VIP会员', 'spec': '专项服务', 'package': '企服套餐'},
                    },

                    {field: 'income', align: 'center', title: '收入', minWidth: 80, search: 'between', searchTip: '收入'},
                    {
                        field: 'retail_type',
                        title: '分销类型',
                        minWidth: 110,
                        align: 'center',
                        templet: yznTable.formatter.label,
                        selectList: {1:'间接推荐',2:'直接推荐'},
                    },
                    {
                        field: 'before_amount',
                        title: '该用户之前的收入',
                        minWidth: 160,
                        align: 'center',
                        search: false,
                        searchTip: '该用户之前的收入'
                    },
                    {
                        field: 'after_amount',
                        title: '该用户之后的金额',
                        minWidth: 160,
                        align: 'center',
                        search: false,
                        searchTip: '该用户之后的金额'
                    },
                    {
                        field: 'create_time',
                        title: '创建时间',
                        minWidth: 80,
                        width: 180,
                        align: 'center',
                        search: 'range',
                        templet: yznTable.formatter.datetime
                    },
                ]
            ],
            page: {}
        });

        yznTable.bindevent();
    });
</script>
{/block}